import { request } from '@/utils/http';

const LOGIN = '/login';
const LOGIN_OUT = '/logout';
const REFRESH_TOKEN = '/refresh/token';

/**
 * 登录
 * @param params
 */
export function login(params: LoginParams) {
    return request.Post<LoginModel>(LOGIN, params);
}

/**
 * 登出
 */
export function logout() {
    return request.Post('/api/user/logout');
}

/**
 * 刷新token
 */
export function refreshToken() {
    return request.Post<LoginModel>(REFRESH_TOKEN, {});
}

/**
 * 获取用户信息
 * @returns
 */
export function getUserInfo() {
    return request.Post('/api/user/index');
}
/**
 * 修改用户信息
 * @returns
 */
export function userProfile(params) {
    return request.Post('/api/user/profile', params);
}
/**
 * 授权登录
 * @param params
 * @returns
 */
export function wxmobileLogin(params) {
    return request.Post('/api/user/wxmobileLogin', params);
}
/**
 * 绑定openid
 * @param params
 * @returns
 */
export function saveOpenid(params) {
    return request.Post('/api/user/saveopenid', params);
}
/**
 * 会员码
 */
export function userQrcode() {
    return request.Get('/api/user/userqrcode');
}
/**
 * 钱包记录
 */
export function userMoneyLog(params) {
    return request.Post('/api/user/money_log', params);
}
